package com.baor.controller;

import com.baor.domain.UserTagVo;
import com.baor.domain.UserVo;
import com.baor.domain.field.OrderSourceField;
import com.baor.feign.DistributionFeign;
import com.baor.service.VipService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/vip")
public class VipController {

    @Autowired
    private VipService vipService;

    //会员列表
    @RequestMapping("/userList")
    public AjaxResult<?> userList(@RequestBody Map<String, Object> params) {
        return vipService.userList(params);
    }

    //会员标签列表
    @RequestMapping("/vipTagList")
    public AjaxResult<?> vipTagList(@RequestBody Map<String, Object> params) {
        return vipService.vipTagList(params);
    }

    //会员注册来源列表
    @RequestMapping("/vipSourceList")
    public AjaxResult<?> vipSourceList(OrderSourceField orderSourceField) {
        return vipService.vipSourceList(orderSourceField);
    }

    @RequestMapping("/addUser")
    public AjaxResult<?> addUser(@RequestBody UserVo userVo) {
        return vipService.addUser(userVo);
    }

    @RequestMapping("/updateUserTag")
    public AjaxResult<?> updateUserTag(@RequestBody UserVo userVo) {
        return vipService.updateUserTag(userVo);
    }

    @RequestMapping("/getUserInfo")
    public AjaxResult<?> getUserInfo(Integer userId) {
        return vipService.getUserInfo(userId);
    }

    @RequestMapping("/userBalanceList")
    public AjaxResult<?> userBalanceList(@RequestBody Map<String, Object> params) {
        return vipService.userBalanceList(params);
    }

    @RequestMapping("/userBalanceDetail")
    public AjaxResult<?> userBalanceDetail(Integer moneyId) {
        return vipService.userBalanceDetail(moneyId);
    }

    @RequestMapping("/calculateBalance")
    public AjaxResult<?> calculateBalance() {
        return vipService.calculateBalance();
    }

    @RequestMapping("/vipCommissionList")
    public AjaxResult<?> vipCommissionList(@RequestBody Map<String, Object> params) {
        return vipService.vipCommissionList(params);
    }

    @Autowired
    private DistributionFeign feign;

    @RequestMapping("/moneyList")
    public AjaxResult<?> moneyList(@RequestBody Map<String,Object> map){
        return feign.moneyList(map);
    }

    @RequestMapping("/yueList")
    public AjaxResult<?> yueList(@RequestBody Map<String,Object> map){
        return feign.yueList(map);
    }

    @RequestMapping("/createCode")
    public AjaxResult<?> getCode(){
        return vipService.getCode();
    }


}
